home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_qt.idb / usr / freeware / include / Qt / qsplitter.h.z / qsplitter.h
Encoding:
C/C++ Source or Header  |  1998-10-28  |  3.0 KB  |  115 lines

  1. /****************************************************************************
  2. ** $Id: qsplitter.h,v 1.11 1998/07/03 00:09:53 hanord Exp $
  3. **
  4. ** Defintion of  QSplitter class
  5. **
  6. **  Created:  980105
  7. **
  8. ** Copyright (C) 1992-1998 Troll Tech AS.  All rights reserved.
  9. **
  10. ** This file is part of Qt Free Edition, version 1.40.
  11. **
  12. ** See the file LICENSE included in the distribution for the usage
  13. ** and distribution terms, or http://www.troll.no/free-license.html.
  14. **
  15. ** IMPORTANT NOTE: You may NOT copy this file or any part of it into
  16. ** your own programs or libraries.
  17. **
  18. ** Please see http://www.troll.no/pricing.html for information about 
  19. ** Qt Professional Edition, which is this same library but with a
  20. ** license which allows creation of commercial/proprietary software.
  21. **
  22. *****************************************************************************/
  23. #ifndef QSPLITTER_H
  24. #define QSPLITTER_H
  25.  
  26. #ifndef QT_H
  27. #include "qframe.h"
  28. #endif // QT_H
  29.  
  30. class QInternalSplitter;
  31.  
  32. class QSplitter : public QFrame
  33. {
  34.     Q_OBJECT
  35. public:
  36.     enum Orientation { Horizontal, Vertical };
  37.     enum ResizeMode { Stretch, KeepSize };
  38.     
  39.     QSplitter( QWidget *parent=0, const char *name=0 );
  40.     QSplitter( Orientation, QWidget *parent=0, const char *name=0 );
  41.  
  42.     void setOrientation( Orientation );
  43.     Orientation orientation() const { return orient; }
  44.  
  45.     void setResizeMode( QWidget *w, ResizeMode );
  46.  
  47.     bool event( QEvent * );
  48.  
  49.     void setOpaqueResize( bool = TRUE );
  50.     bool opaqueResize() const { return opaque; }
  51.  
  52.     void moveToFirst( QWidget * );
  53.     void moveToLast( QWidget * );
  54.     
  55.     //void setHidden( QWidget *, bool );
  56.     //bool isHidden( QWidget *) const;
  57.  
  58.     void refresh() { recalc( TRUE ); }
  59.     
  60. protected:
  61.     void childInsertEvent( QChildEvent * );
  62.     void childRemoveEvent( QChildEvent * );
  63.     void layoutHintEvent( QEvent * );
  64.     void resizeEvent( QResizeEvent * );
  65.  
  66.     void moveSplitter( QCOORD pos );
  67.     virtual void drawSplitter( QPainter*, QCOORD x, QCOORD y,
  68.                    QCOORD w, QCOORD h );
  69.  
  70.     int adjustPos( int );
  71.     void setRubberband( int );
  72.     // virtual int border2()
  73.  
  74. private:
  75.     void init();
  76.     void recalc( bool update = FALSE );
  77.     int hit( QPoint p );
  78.     void doResize();
  79.     QWidget *splitterWidget();
  80.  
  81.     void startMoving();
  82.     void moveTo( QPoint );
  83.     void stopMoving( );
  84.  
  85.  
  86.  
  87.     QCOORD pick( const QPoint &p ) const
  88.     { return orient == Horizontal ? p.x() : p.y(); }
  89.     QCOORD pick( const QSize &s ) const
  90.     { return orient == Horizontal ? s.width() : s.height(); }
  91.  
  92.     QCOORD trans( const QPoint &p ) const
  93.     { return orient == Vertical ? p.x() : p.y(); }
  94.     QCOORD trans( const QSize &s ) const
  95.     { return orient == Vertical ? s.width() : s.height(); }
  96.  
  97.     QCOORD newpos() const;
  98.  
  99.     QWidget *w1;
  100.     QWidget *w2;
  101.     int moving;
  102.     //    bool w1show;
  103.     //    bool w2show;
  104.     QWidget *fixedWidget;
  105.     QInternalSplitter *d;
  106.     bool opaque;
  107.  
  108.     Orientation orient;
  109.     QCOORD bord; //half border
  110.     friend class QInternalSplitter;
  111. };
  112.  
  113.  
  114. #endif //QSPLITTER_H
  115.